//
//  GSStrategyFocusCell.m
//  GameSky
//
//  Created by lanou on 16/1/11.
//  Copyright © 2016年 NiRongfei. All rights reserved.
//

#import "GSStrategyFocusCell.h"

@implementation GSStrategyFocusCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        // 夜间模式
        self.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);
        
        self.coverImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight * 0.8)];
        [self.contentView addSubview:self.coverImage];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.coverImage.bottom, kWidth, kHeight * 0.2)];
        self.titleLabel.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor grayColor]);
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.titleLabel];
        
        self.hotImage = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth - 20, 0, 20, 30)];
        [self.contentView addSubview:self.hotImage];
    }
    return self;
}

- (void)setModel:(GSStrategyMainModel *)model
{
    _model = model;
    [self.coverImage sd_setImageWithURL:[NSURL URLWithString:model.thumbnailUrl] placeholderImage:kPHImage];
    self.titleLabel.text = model.title;
    // 保存图片;
    _model.image = _coverImage.image;
    
    // 判断模型favoriteCnt属性值,如果超过500就显示右上角HOT图片;
    if ([model.favoriteCnt intValue] > 500) {
        self.hotImage.image = [UIImage imageNamed:@"common_Badge_ReMenShouCang_18x25_UIMode_Day"];
    } else {
        self.hotImage.image = nil;
    }
}

@end
